import Mock from "mockjs";
// import { homeMock } from "./Home";
// import { purchaseMock } from "./purchase";
// import { AnnouncementManagementMock } from './AnnouncementManagement';
Mock.setup({
  timeout: '200-600'
})

// ts里require.context出错，可使用require["context"]或npm i @types/webpack-env -D
const modulesFiles = require["context"]('./', true, /\.ts$/)

const modules = modulesFiles.keys().reduce((modules, modulePath) => {
  // 忽略第1个ts
  const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
  // 执行modulesFiles函数，返回一个对象{default: {// 文件内容}, _esModule: true}
  const value = modulesFiles(modulePath)
  modules[moduleName] = value.default
  return modules
}, {})

// let mockData = {}
// if (process.env.REACT_APP_ENV == 'local') {
//   console.log('modules',modules)
//   mockData = {
//     // homeMock,
//     // purchaseMock,
//     // AnnouncementManagementMock
//     modules
//   }
// }

// export default mockData

/*

*/